package com.sihai.ehr.model.biz;

import com.sihai.core.BaseEntity;
import com.sihai.ehr.model.sys.AuditStatus;

import javax.persistence.*;
import java.util.List;

/**
 * @author wxn
 * @since 12-5-27 16:27
 *
 * 工作说明书表
 */
@Entity
public class JobSpecification extends BaseEntity<Long> {

    public static enum Sex {
        male("男"), female("女"), none("不限");

        private Sex(String name) {
            this.name = name;
        }
        private String name;
        public String getName() {
            return this.name;
        }
    }
    
    /**
     * serialVersionUID
     */
    private static final long serialVersionUID = -3270612230995962389L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "duty_id")
    private Duty duty; /* 职务  */

    private String content; /* 工作说明书内容 */
    private String remark; /* 备注 */
    private String auditNo; /* 审核流程编号 */
    @Enumerated(EnumType.STRING)
    private AuditStatus auditStatus; /* 审核状态 */


    //start from detail model
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "pre_duty_id")
    private Duty preDuty; /*业务负责对象(上)*/

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "next_duty_id")
    private Duty nextDuty; /*业务负责对象(下)*/

    private String taskContent; /*岗位职责*/

    //@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, orphanRemoval = true)
    @OneToMany(fetch = FetchType.LAZY)
	@JoinColumn(name = "job_specification_id")
    private List<JobSpecificationProject> projects; /*主要工作项目(一对多)*/

    //暂时删除这几个字段(需求变动)
//    private String xzExamine; /*行政考核*/
//    private String rsExamine; /*人事考核*/
//    private String zgExamine; /*主管考核*/
//    private String tsExamine; /*同事考核*/
//    private String xsExamine; /*下属考核*/
//    private String cwExamine; /*财务考核*/
//    private String jxExamine; /*关键绩效指标考核*/

    @Enumerated(EnumType.STRING)
    private Sex sex; /*性别*/

    @Enumerated(EnumType.STRING)
    private Education education; /*学历*/
    private String training; /*培训*/
    private String certificate; /*证书*/
    @Enumerated(EnumType.STRING)
    private EnglishLevel english; /*英文程度*/

    private String experience; /*工作经验能力*/

    private String jobTime; /*工作时间*/
    private String jobEnvironment; /*工作环境*/

    //将String改为Duty(需求变动)
//    private String jsJob; /*可晋升职位*/
//    private String lhJob; /*可轮换职位*/
//    private String dlJob; /*可代理职位*/
//    private String jszcJob; /*可晋升至此的职位*/

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "js_duty_id")
    private Duty jsJob; /*可晋升职位*/

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "lh_duty_id")
    private Duty lhJob; /*可轮换职位*/

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "dl_duty_id")
    private Duty dlJob; /*可代理职位*/

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "jszc_duty_id")
    private Duty jszcJob; /*可晋升至此的职位*/
    //end from detail model

    private boolean cancel; /* 是否删除 */

    @Override
    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Duty getDuty() {
        return duty;
    }

    public void setDuty(Duty duty) {
        this.duty = duty;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getAuditNo() {
        return auditNo;
    }

    public void setAuditNo(String auditNo) {
        this.auditNo = auditNo;
    }

    public AuditStatus getAuditStatus() {
        return auditStatus;
    }

    public void setAuditStatus(AuditStatus auditStatus) {
        this.auditStatus = auditStatus;
    }

    public Duty getPreDuty() {
        return preDuty;
    }

    public void setPreDuty(Duty preDuty) {
        this.preDuty = preDuty;
    }

    public Duty getNextDuty() {
        return nextDuty;
    }

    public void setNextDuty(Duty nextDuty) {
        this.nextDuty = nextDuty;
    }

    public String getTaskContent() {
        return taskContent;
    }

    public void setTaskContent(String taskContent) {
        this.taskContent = taskContent;
    }

    public List<JobSpecificationProject> getProjects() {
        return projects;
    }

    public void setProjects(List<JobSpecificationProject> projects) {
        this.projects = projects;
    }

    public Sex getSex() {
        return sex;
    }

    public void setSex(Sex sex) {
        this.sex = sex;
    }

    public Education getEducation() {
        return education;
    }

    public void setEducation(Education education) {
        this.education = education;
    }

    public String getTraining() {
        return training;
    }

    public void setTraining(String training) {
        this.training = training;
    }

    public String getCertificate() {
        return certificate;
    }

    public void setCertificate(String certificate) {
        this.certificate = certificate;
    }

    public EnglishLevel getEnglish() {
        return english;
    }

    public void setEnglish(EnglishLevel english) {
        this.english = english;
    }

    public String getExperience() {
        return experience;
    }

    public void setExperience(String experience) {
        this.experience = experience;
    }

    public String getJobTime() {
        return jobTime;
    }

    public void setJobTime(String jobTime) {
        this.jobTime = jobTime;
    }

    public String getJobEnvironment() {
        return jobEnvironment;
    }

    public void setJobEnvironment(String jobEnvironment) {
        this.jobEnvironment = jobEnvironment;
    }

    public Duty getJsJob() {
        return jsJob;
    }

    public void setJsJob(Duty jsJob) {
        this.jsJob = jsJob;
    }

    public Duty getLhJob() {
        return lhJob;
    }

    public void setLhJob(Duty lhJob) {
        this.lhJob = lhJob;
    }

    public Duty getDlJob() {
        return dlJob;
    }

    public void setDlJob(Duty dlJob) {
        this.dlJob = dlJob;
    }

    public Duty getJszcJob() {
        return jszcJob;
    }

    public void setJszcJob(Duty jszcJob) {
        this.jszcJob = jszcJob;
    }

    public boolean isCancel() {
        return cancel;
    }

    public void setCancel(boolean cancel) {
        this.cancel = cancel;
    }
}
